<<xAct`xCoba`

$PrePrint=ScreenDollarIndices;

DefManifold[M,4,IndexRange[a,f]]

DefBasis[cartesian,TangentM,{0,1,2,3}]

v=CTensor[{1,3,5,7},{cartesian}]

v[a]

the metric is not defined yet, so we can’t do

v[-a]

define an anti-symmetric tensor

values=Table[i-j,{i,4},{j,4}]

F=CTensor[values,{-cartesian, -cartesian}]

F[-a,-b]

F[-a,-b]v[b]

we can switch between the CTensor notation and the “linear combination notation”

v[a]

%//ToBasisExpand

FromBasisExpand[%,{cartesian}]

Schwarzschild metric

first, we define a coordinate system:

DefChart[coord,M,{0,1,2,3},{t[],r[],θ[],φ[]},ChartColor->Orange]

and the metric:

DefConstantSymbol[Mass,PrintAs->"M"]

metric=CTensor[DiagonalMatrix[{(1-2(Mass/(r[]))),(((1-2(Mass/(r[]))))^(-1)),((r[])^2),((r[])^2)((Sin[θ[]])^2)}],{-coord,-coord}];

metric[-a,-b]

associate the metric to the manifold:

SetCMetric[metric,coord,SignatureOfMetric->{3,1,0}]

now, raising and lowering of indices works:

v=CTensor[{1,0,0,0},{coord}];

v[a]

v[-a]

v[a]v[-a]

covariant derivative associated with the metric

CD=CovDOfMetric[metric];

CD[-a][v[b]]

CD[-a][metric[-b,-c]]

curvature tensors:

Ricci[CD][-a,-b]

Riemann[CD][-a,-b,-c,-d]

Riemann[CD][-a,-b,-c,-d]==Weyl[CD][-a,-b,-c,-d]